home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 038a / txt89a.zip / TXT89A.BAS < prev    next >
BASIC Source File  |  1990-09-08  |  3KB  |  110 lines

  1. 'TXT89a.BAS (c) Copyright 1990 Lawrence Gozum & Marvin Gozum, MD.
  2.  
  3. 'Greeting GIF Developers and QB fans !
  4.  
  5. 'This QB demo shows how to integrate TXT89A.ASM routines into a
  6. 'QB GIF89a decoder.  TXT89A.OBJ can be linked with any of your
  7. '*.QLB QB libraries or added to your *.LIB for stand-alone
  8. 'integration without the BRUN41.exe runtime-module.
  9.  
  10. 'Here, the default 8x8 system bitmap font is used and expanded
  11. 'to 16x16 character cells using the default 256-color palette.
  12. 'You can actually 'bload' your own chracter definition in a reserved
  13. 'area of memory and point CHARseg and CHARptr to it.
  14.  
  15. 'Initially, a quarter of the screen will be filled with random dots.
  16. 'After pressing any key, 96 character from &H20 to &H7F will be printed
  17. 'with rainbow colors against a black background.
  18.  
  19. 'The transparency flag is set, thus you should see the random dots
  20. 'showing 'thru' the characters.
  21.  
  22. 'This code (ie., TXT89A.BAS) is hereby released to the Public Domain and
  23. 'can be used anywhere and by anyone in ANY fashion they choose.  We hope
  24. 'this will encourage the acceleration of GIF89a decoder development.  
  25. 'A little acknowldegement of its use or variation of its use would be more
  26. 'than appreciated.
  27.  
  28. 'I hope this helps you.  Enjoy.
  29.  
  30. 'lawrence - 09 September 1990
  31.  
  32.  
  33. DEFINT A-Z
  34. DECLARE SUB dec2int (f AS SINGLE, i AS INTEGER)
  35. RANDOMIZE TIMER
  36.  
  37. SCREEN 13
  38. DIM CHX(256) AS INTEGER
  39. DIM CHY(256) AS INTEGER
  40.  
  41. CHXseg = VARSEG(CHX(0)): '        interpolated x look-up table
  42. CHXptr = VARPTR(CHX(0))
  43.  
  44. CHYseg = VARSEG(CHY(0)): '        interpolated y look-up table
  45. CHYptr = VARPTR(CHY(0))
  46.  
  47.  
  48. 'DEC2INT sub-routine adjusts the floating point vectors to integer values
  49.  
  50. DEF SEG = 0
  51. v1! = PEEK(&H10C): v2! = PEEK(&H10C + 1)
  52. CharLo! = v1! + v2! * 256: CALL dec2int(CharLo!, CHARptr)
  53. v1! = PEEK(&H10C + 2): v2! = PEEK(&H10C + 3)
  54. CharHi! = v1! + v2! * 256: CALL dec2int(CharHi!, CHARseg)
  55.  
  56. COLOR 15
  57. LOCATE 20, 1: PRINT "Press any key to show characters."
  58.  
  59. tflag = 1: '            transparency flag 1=ON 0=OFF
  60. tcolor = 15: '          transparaent color
  61. CharBits = 8: '         width of source character cells
  62. CharL = 8: '            height of source character cells
  63. CharW = 16: '           user defined character width
  64. CharH = 16: '           user defined character height
  65.  
  66. 'pass your parameters
  67. CALL CharParms(CHARseg, CHARptr, CharW, CharH, CharL, tflag, tcolor)
  68.  
  69. 'pass interpolation data
  70. FOR x = 0 TO CharW: CHX(x) = INT(CharBits * x / CharW): NEXT
  71. CALL GetCharXpts(CHXseg, CHXptr)
  72. FOR y = 0 TO CharH: CHY(y) = INT(CharL * y / CharH): NEXT
  73. CALL GetCharYpts(CHYseg, CHYptr)
  74.  
  75. 'plot some random dots to demonstrate transparency
  76.  
  77. DO WHILE a$ = ""
  78.         x = RND * 160
  79.         y = RND * 100
  80.         PSET (x, y), tcolor
  81.         a$ = INKEY$
  82. LOOP
  83.  
  84. bc = 0
  85. fc = 32
  86. FOR y = 2 TO 7
  87.         x1 = y * 16: x2 = x1 + 15
  88.         x = 0
  89.         yy = y * (CharH + 1)
  90.         FOR char = x1 TO x2
  91.                 fc = fc + 1
  92.                 CALL XVGAtext(char, x, yy, fc, bc)
  93.                 x = x + CharW + 1
  94.         NEXT
  95. NEXT
  96. GOTO quit
  97.  
  98. quit:
  99. a$ = INPUT$(1)
  100. SCREEN 0: WIDTH 80: CLS
  101. END
  102.  
  103. DEFSNG A-Z
  104. SUB dec2int (f AS SINGLE, i AS INTEGER)
  105.         IF f <= 32767 THEN i = FIX(f): EXIT SUB
  106.         ii! = -65536 + f
  107.         i = CINT(ii!)
  108. END SUB
  109.  
  110.